package com.ftg.shopping.pro.controller;


import com.ftg.shopping.config.LayuiPage;
import com.ftg.shopping.pro.service.ProService;
import com.ftg.shopping.pro.entity.sp_productintroduction;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(description ="会员管理")
@RestController
@RequestMapping("/api/pro")
public class ProController {

    @Autowired
    ProService proService;

    @ApiOperation("查看会员全部数据")
    @GetMapping("/list")
    public LayuiPage<sp_productintroduction> list(){
        return proService.list();
    }



    @ApiOperation("添加一个会员")
    @PostMapping("/insert")
    public int savepro(sp_productintroduction p){
        return proService.savepro(p);
    }

    @ApiOperation("更改一个角色")
    @PostMapping("/update")
    public int updatepro(sp_productintroduction p){
        return proService.updatepro(p);
    }
    @ApiOperation("删除一个会员")
    @DeleteMapping("/delete")
    public  int deletepro( int id){
        return proService.deletepro(id);
    }


    @ApiOperation("分页查询带模糊")
    @GetMapping("/page1")
    public LayuiPage<sp_productintroduction> list1(@RequestParam int page,@RequestParam int limit,@RequestParam(required = false) String id  ){
        return proService.page1(page,limit,id);

    }


}
